package com.fm.financemanage.controller;

import com.fm.financemanage.component.RedisComponent;
import com.fm.financemanage.constant.ResponseEnum;
import com.fm.financemanage.constant.annotation.Require;
import com.fm.financemanage.model.vo.operator.login.LoginVo;
import com.fm.financemanage.model.vo.operator.newmember.NewMemberVo;
import com.fm.financemanage.model.vo.operator.reducemember.ReduceMemberVo;
import com.fm.financemanage.response.Callback;
import com.fm.financemanage.response.JsonData;
import com.fm.financemanage.service.CustomerOperatorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;

@RequestMapping("/customer/operator")
@Api(tags = "客户操作相关")
@RestController
@Validated
public class CustomerOperatorController {


    @Autowired
    private RedisComponent redisComponent;

    @Autowired
    private CustomerOperatorService customerOperatorService;


    @PostMapping("/login")
    @ApiOperation("登录")
    public JsonData operator(HttpServletRequest requet, HttpServletResponse response,
                             @RequestBody LoginVo loginVo,
                             @ApiParam(name = "customerUuids", value = "客户uuids", required = true) @NotBlank(message = "客户信息id必选")
                             @RequestParam(name = "customerUuids", required = false) String customerUuids
    ) {


        return Callback.success(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMemo());
    }
    @Require
    @PostMapping("/new/member")
    @ApiOperation("增员")
    public JsonData operator(HttpServletRequest requet, HttpServletResponse response,
                             @RequestBody NewMemberVo newMemberVo,
                             @ApiParam(name = "customerUuids", value = "多个用逗号隔开,", required = true) @NotBlank(message = "客户信息id必选")
                             @RequestParam(name = "customerUuids", required = false) String customerUuids
    ) {


        return Callback.success(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMemo());
    }

    @Require
    @PostMapping("/reduce/member")
    @ApiOperation("减员")
    public JsonData operator(HttpServletRequest requet, HttpServletResponse response,
                             @RequestBody ReduceMemberVo reduceMemberVo,
                             @ApiParam(name = "customerUuids", value = "多个用逗号隔开,", required = true) @NotBlank(message = "客户信息id必选")
                             @RequestParam(name = "customerUuids", required = false) String customerUuids
    ) {


        return Callback.success(ResponseEnum.SUCCESS.getCode(), ResponseEnum.SUCCESS.getMemo());
    }
}
